<?php include ("checkLanguage.php");?>
<p><b><i><?=$this->aDisplayedContent['error']?></i></b></p>
<p>
<table>
<tr>
<td>
<form
	action="index.php?co=newPage&type=category&ppid=<?=$this->aDisplayedContent['productPageID']?>"
	method="post"><input type="submit" name="newCategory"
	value="Neue Kategorie anlegen" align="right" /></form>
	</td>
	<td>
	<form action=<?="index.php?co=contentPage&id=".$this->aDisplayedContent['productPageID']?> method="post">
			<input type="submit" name="Insert" value="Beschreibung bearbeiten" align="right">
	</form>
	</td>
	</tr>
	</table>
</p>

<noscript>
<table>
	<tr>
		<td colspan="6" align="right">Sprache ist: <input type="text" id="lid"
			style="font-size: 92%" name="lid" value="<?=$sDefaultS?>" size="7"
			disabled="disabled"></td>
	</tr>
	<tr>
		<td><br>
		</td>
	</tr>
</table>

<form action="index.php?co=product&method=saveCategories" method="post">
<input type="hidden" name="productPageID"
	value="<?=$this->aDisplayedContent['productPageID']?>"> <?php 
	$iCounter = 0;
	$aCategories = $this->aDisplayedContent['content'];
	if(is_array($aCategories[0])){
	    foreach($aCategories as $aCategory){?>

<table>

<?php if($iCounter == 0){?>
	<tr>
	<?php /**<th></th>
	<th>Unterseite von&nbsp;&nbsp;&nbsp;</th>**/?>
		<th>Pos.&nbsp;&nbsp;&nbsp;</th>
		<th>Kategoriebezeichnung</th>
		<th colspan="2" align="left">Sichtbar?</th>
	</tr>
	<?php $iCounter++;}?>
	<tr <?php if($aCategory['parent'] == ""){echo "bgcolor=\"#ccc\"";}?>>
	<?php /**<td width="<?=$aElement['level']*15?>"></td>
	<td><select style="font-size: 92%" name="parent<?=$aElement['id'] ?>">
	<option value="">------------------------------</option>
	<?php foreach($this->aDisplayedContent['content'] as $aParent){
	if($aElement['id'] != 2){
	if($aParent['id'] != $aElement['id']){?>

	<option value="<?=$aParent['id']?>"
	<?php if($aParent['id']==$aElement['parent']){echo "selected";}?>><?=$aParent['name']?></option>

	<?php }}}?>
	</select>&nbsp;&nbsp;&nbsp;</td>**/?>
		<td><input size="2px" type="text"
			name="position<?=$aCategory['id'] ?>" maxlength="2" class="text"
			value="<?=$aCategory['position']?>" />&nbsp;&nbsp;&nbsp;</td>
		<td><input type="text" name="name<?=$aCategory['id'] ?>" size="30"
			maxlength="50" class="text" value="<?=$aCategory['name']?>" /></td>
		<td><select style="font-size: 92%"
			name="visible<?=$aCategory['id'] ?>">
			<option value="1"
			<?php if($aCategory['visible'] == 1) echo "selected";?>>ja</option>
			<option value="0"
			<?php if($aCategory['visible'] == 0) echo "selected";?>>nein</option>
		</select></td>



		<td>
		<form></form>

		<form <?php if($aCategory['id'] != 2){?>
			action="<?="index.php?co=contentPage&id=".$aCategory['id']?>"
			method="Post" <?php }?>><?php if($aCategory['id'] != 2){?><input
			type="submit" value="Beschreibung bearbeiten" class="submit" /><?php }?></form>
		</td>
		<td><a
			href='index.php?co=pageStructure&method=deletePage&id=<?=$aCategory['id']?>'><img
			src='../image/remove.png' align=right width=30px height=30px alt="Seite L&ouml;schen"></a></td>


	</tr>
</table>

			<?php }?>

<p><input type="submit" name="method" value="&Auml;nderungen speichern"
	align="right" /></p>
</form>

			<?php }?></noscript>

<!-- ------------------------------------------------------------------------------------------------------- -->

<script
	src="../lokesh-lightbox2-a9e6453/js/jquery-1.7.2.min.js"></script>
<script
	src="../lokesh-lightbox2-a9e6453/js/lightbox.js"></script>
<script src="../js/js/jquery-1.7.2.min.js"> </script>
<script
	src="../js/js/jquery-ui-1.8.21.custom.min.js"></script>

<style>
#sortable {
	list-style-type: none;
	margin: 0;
	padding: 0;
	width: 60%;
}

#sortable li {
	margin: 0 3px 3px 3px;
	padding: 0.4em;
	padding-left: 1.5em;
	font-size: 1.4em;
	height: 18px;
}

#sortable li span {
	position: absolute;
	margin-left: -1.3em;
}
</style>

<script>
                
                
        $(document).ready(function(){
                $("#sortable").css({'display': 'block'});
                $("#sortable").sortable({
                  update: function(event, ui) {
                    var updSort = $(this).sortable('toArray').toString();
                    
                    
                    $.ajax({
                      type: "POST",
                      url: "index.php?a=ajax&co=product&m=updateCategoryStructure",
                      data: {updSort : updSort},
                      success: function(data){
                        
                      }
                     })
                  }
                
                });
                $( "#sortable" ).disableSelection();
        });
        </script>

<style>
#sortable {
	display: none;
}
</style>

			<?php if(is_array($aCategories[0])){?>
<div class="demo">

<div id="sortable"><?php foreach($aCategories as $aCategory){?>

<div id="<?=$aCategory['id']?>">

<table width="100%">
	<tr>
		<td class="CategoryName"><a href="index.php?co=product&ca=<?=$aCategory['id']?>"><?=$aCategory['name']?></a></td>
		<td align="center" width="190px"><a href="index.php?co=contentPage&id=<?=$aCategory['id']?>">Beschreibung bearbeiten</a></td>


		<td align="right" class="deletePage" width="30px"><a
			href='index.php?co=pageStructure&method=deletePage&id=<?=$aCategory['id']?>'><img
			src='../image/remove.png' align=right width=30px height=30px></a></td>
	</tr>
	<tr></tr>
</table>
</div>
<br>

		<?php }?></div>
</div>
		<?php  }else{echo "$aCategories";}?>

